home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / midipk.exe / SYSEX.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-06-27  |  21.7 KB  |  605 lines

  1. VERSION 4.00
  2. Begin VB.Form frmMain 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "MIDI CoolTools - System Exclusive Example"
  5.    ClientHeight    =   3750
  6.    ClientLeft      =   3540
  7.    ClientTop       =   3630
  8.    ClientWidth     =   9255
  9.    BeginProperty Font 
  10.       name            =   "MS Sans Serif"
  11.       charset         =   0
  12.       weight          =   700
  13.       size            =   8.25
  14.       underline       =   0   'False
  15.       italic          =   0   'False
  16.       strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H80000008&
  19.    Height          =   4440
  20.    Icon            =   "SYSEX.frx":0000
  21.    Left            =   3480
  22.    LinkTopic       =   "Form1"
  23.    MaxButton       =   0   'False
  24.    ScaleHeight     =   3750
  25.    ScaleWidth      =   9255
  26.    Top             =   3000
  27.    Width           =   9375
  28.    Begin VB.Frame FrameSysexList 
  29.       Caption         =   "Sysex Bank List"
  30.       Height          =   1755
  31.       Left            =   30
  32.       TabIndex        =   11
  33.       Top             =   30
  34.       Width           =   4185
  35.       Begin VB.ListBox ListSysex 
  36.          Appearance      =   0  'Flat
  37.          Height          =   1395
  38.          Left            =   120
  39.          MultiSelect     =   2  'Extended
  40.          TabIndex        =   12
  41.          Top             =   270
  42.          Width           =   3825
  43.       End
  44.    End
  45.    Begin VB.Frame FrameSysexEdit 
  46.       Caption         =   "Edit MIDI System Exclusive Message"
  47.       Height          =   1365
  48.       Left            =   30
  49.       TabIndex        =   9
  50.       Top             =   1860
  51.       Width           =   9135
  52.       Begin VB.TextBox TextSysex 
  53.          Appearance      =   0  'Flat
  54.          BeginProperty Font 
  55.             name            =   "MS Sans Serif"
  56.             charset         =   0
  57.             weight          =   400
  58.             size            =   8.25
  59.             underline       =   0   'False
  60.             italic          =   0   'False
  61.             strikethrough   =   0   'False
  62.          EndProperty
  63.          Height          =   1005
  64.          Left            =   90
  65.          MultiLine       =   -1  'True
  66.          ScrollBars      =   1  'Horizontal
  67.          TabIndex        =   10
  68.          Text            =   "SYSEX.frx":030A
  69.          Top             =   270
  70.          Width           =   8955
  71.       End
  72.    End
  73.    Begin VB.Frame Frame5 
  74.       Caption         =   "MIDI Filter"
  75.       Height          =   1755
  76.       Left            =   7410
  77.       TabIndex        =   6
  78.       Top             =   30
  79.       Width           =   1755
  80.       Begin VB.CheckBox CheckMIDIFilter1 
  81.          Caption         =   "Active Sensing"
  82.          BeginProperty Font 
  83.             name            =   "MS Sans Serif"
  84.             charset         =   0
  85.             weight          =   400
  86.             size            =   8.25
  87.             underline       =   0   'False
  88.             italic          =   0   'False
  89.             strikethrough   =   0   'False
  90.          EndProperty
  91.          Height          =   225
  92.          Left            =   150
  93.          TabIndex        =   1
  94.          Top             =   1200
  95.          Value           =   1  'Checked
  96.          Width           =   1395
  97.       End
  98.       Begin VB.CheckBox CheckMIDIFilter2 
  99.          Caption         =   "Undefined F9"
  100.          BeginProperty Font 
  101.             name            =   "MS Sans Serif"
  102.             charset         =   0
  103.             weight          =   400
  104.             size            =   8.25
  105.             underline       =   0   'False
  106.             italic          =   0   'False
  107.             strikethrough   =   0   'False
  108.          EndProperty
  109.          Height          =   225
  110.          Left            =   150
  111.          TabIndex        =   8
  112.          Top             =   840
  113.          Value           =   1  'Checked
  114.          Width           =   1335
  115.       End
  116.       Begin VB.CheckBox CheckMIDIFilter3 
  117.          Caption         =   "MIDI Time Clock"
  118.          BeginProperty Font 
  119.             name            =   "MS Sans Serif"
  120.             charset         =   0
  121.             weight          =   400
  122.             size            =   8.25
  123.             underline       =   0   'False
  124.             italic          =   0   'False
  125.             strikethrough   =   0   'False
  126.          EndProperty
  127.          Height          =   405
  128.          Left            =   150
  129.          TabIndex        =   7
  130.          Top             =   330
  131.          Value           =   1  'Checked
  132.          Width           =   1455
  133.       End
  134.    End
  135.    Begin VB.Frame Frame4 
  136.       Caption         =   "Receive [In] System Exclusive"
  137.       Height          =   705
  138.       Left            =   4290
  139.       TabIndex        =   4
  140.       Top             =   30
  141.       Width           =   3075
  142.       Begin VB.CommandButton CmdReceiveSysex 
  143.          Appearance      =   0  'Flat
  144.          BackColor       =   &H80000005&
  145.          Caption         =   "Receive Sysex Message"
  146.          BeginProperty Font 
  147.             name            =   "MS Sans Serif"
  148.             charset         =   0
  149.             weight          =   400
  150.             size            =   8.25
  151.             underline       =   0   'False
  152.             italic          =   0   'False
  153.             strikethrough   =   0   'False
  154.          EndProperty
  155.          Height          =   315
  156.          Left            =   60
  157.          TabIndex        =   5
  158.          Top             =   270
  159.          Width           =   2925
  160.       End
  161.    End
  162.    Begin VB.Frame Frame3 
  163.       Caption         =   "Send [Out] System Exclusive"
  164.       Height          =   735
  165.       Left            =   4290
  166.       TabIndex        =   2
  167.       Top             =   750
  168.       Width           =   3075
  169.       Begin VB.CommandButton CmdSendSysex 
  170.          Appearance      =   0  'Flat
  171.          BackColor       =   &H80000005&
  172.          Caption         =   "Send Selected Sysex Message"
  173.          BeginProperty Font 
  174.             name            =   "MS Sans Serif"
  175.             charset         =   0
  176.             weight          =   400
  177.             size            =   8.25
  178.             underline       =   0   'False
  179.             italic          =   0   'False
  180.             strikethrough   =   0   'False
  181.          EndProperty
  182.          Height          =   315
  183.          Left            =   60
  184.          TabIndex        =   3
  185.          Top             =   300
  186.          Width           =   2925
  187.       End
  188.    End
  189.    Begin MidiioLib.MIDIOutput MIDIOutput1 
  190.       Left            =   600
  191.       Top             =   3240
  192.       _Version        =   65537
  193.       _ExtentX        =   847
  194.       _ExtentY        =   847
  195.       _StockProps     =   0
  196.       DeviceID        =   0
  197.       VolumeLeft      =   -1
  198.       VolumeRight     =   -1
  199.    End
  200.    Begin MidiioLib.MIDIInput MIDIInput1 
  201.       Left            =   120
  202.       Top             =   3240
  203.       _Version        =   65537
  204.       _ExtentX        =   847
  205.       _ExtentY        =   847
  206.       _StockProps     =   0
  207.       MessageEventEnable=   -1  'True
  208.       MaxSysexSize    =   32000
  209.    End
  210.    Begin MSComDlg.CommonDialog CMDialog1 
  211.       Left            =   1080
  212.       Top             =   3240
  213.       _Version        =   65536
  214.       _ExtentX        =   847
  215.       _ExtentY        =   847
  216.       _StockProps     =   0
  217.       DialogTitle     =   "System Exclusive Binary Files"
  218.       Filter          =   "(*.syx) Sysex |*.syx|"
  219.    End
  220.    Begin VB.Label LblInQueue 
  221.       Appearance      =   0  'Flat
  222.       BackColor       =   &H00000000&
  223.       Caption         =   " MIDI Sysex Status"
  224.       BeginProperty Font 
  225.          name            =   "MS Sans Serif"
  226.          charset         =   0
  227.          weight          =   400
  228.          size            =   8.25
  229.          underline       =   0   'False
  230.          italic          =   0   'False
  231.          strikethrough   =   0   'False
  232.       EndProperty
  233.       ForeColor       =   &H0000FF00&
  234.       Height          =   225
  235.       Left            =   4290
  236.       TabIndex        =   0
  237.       Top             =   1530
  238.       Width           =   3075
  239.    End
  240.    Begin VB.Menu mnuFile 
  241.       Caption         =   "&File"
  242.       Begin VB.Menu mnuFileLoadBank 
  243.          Caption         =   "&Load Bank"
  244.       End
  245.       Begin VB.Menu MnuSaveBankAs 
  246.          Caption         =   "Save Bank &As..."
  247.          Shortcut        =   ^A
  248.       End
  249.       Begin VB.Menu mnuFileSep1 
  250.          Caption         =   "-"
  251.       End
  252.       Begin VB.Menu mnuFileExit 
  253.          Caption         =   "E&xit"
  254.       End
  255.    End
  256.    Begin VB.Menu mnuMidi 
  257.       Caption         =   "&MIDI"
  258.       Begin VB.Menu mnuMidiSetup 
  259.          Caption         =   "&Setup"
  260.       End
  261.       Begin VB.Menu mnuMidiThru 
  262.          Caption         =   "&Thru"
  263.          Checked         =   -1  'True
  264.       End
  265.    End
  266.    Begin VB.Menu mnuHelp 
  267.       Caption         =   "&Help"
  268.       Begin VB.Menu mnuHelpAbout 
  269.          Caption         =   "&About"
  270.       End
  271.    End
  272. Attribute VB_Name = "frmMain"
  273. Attribute VB_Creatable = False
  274. Attribute VB_Exposed = False
  275. Option Explicit
  276. Dim DisplayBufferString(200) As String
  277. Dim UserMessage As String
  278. Private Sub CheckMIDIFilter1_Click()
  279.     If CheckMIDIFilter1.Value = 0 Then
  280.         MIDIInput1.Filter(FILTER_F9) = False
  281.     Else
  282.         MIDIInput1.Filter(FILTER_F9) = True
  283.     End If
  284. End Sub
  285. Private Sub CheckMIDIFilter2_Click()
  286.     If CheckMIDIFilter2.Value = 0 Then
  287.         MIDIInput1.Filter(FILTER_ACTIVE_SENSE) = False
  288.     Else
  289.         MIDIInput1.Filter(FILTER_ACTIVE_SENSE) = True
  290.     End If
  291. End Sub
  292. Private Sub CheckMIDIFilter3_Click()
  293.     If CheckMIDIFilter3.Value = 0 Then
  294.         MIDIInput1.Filter(FILTER_CLOCK) = False
  295.     Else
  296.         MIDIInput1.Filter(FILTER_CLOCK) = True
  297.     End If
  298. End Sub
  299. Private Sub CmdReceiveSysex_Click()
  300.     MIDIInput1.Action = MIDIIN_START
  301.     ' MIDI Data is being received
  302.     LblInQueue.Caption = " Waiting for data..."
  303. End Sub
  304. Private Sub CmdReceiveSysex_LostFocus()
  305.     'UserMessage string is used when data is being received.
  306.     'It is used only to show that progress is happening
  307.     UserMessage = " Receiving data..."
  308. End Sub
  309. Private Sub CmdSendSysex_Click()
  310.     Dim I As Integer
  311.     Dim n As Integer
  312.     Dim SysexMessage As String
  313.     Dim StringPosition As Integer
  314.     '**NOTE**
  315.     '
  316.     'If all you want to do is send simple sysex messages, you can format
  317.     'them as simple as this example.  (A Sysex message is sent which resets
  318.     'the Roland SoundCanvas SC-88 to General MIDI mode)
  319.     '
  320.     'Midioutput1.message = &HF0
  321.     'Midioutput1.Buffer = Chr$(&HF0) + Chr$(&H7E) + Chr$(&H7F) + Chr$(9) + Chr$(1) + Chr$(&HF7)
  322.     'Midioutput1.Action = MIDIOUT_SEND
  323.     '
  324.     'In this example the first and last bytes (&HF0 and &HF7) signal the
  325.     'beginning and end of a Sysex message.  The middle bytes are the Sysex
  326.     'message contents.
  327.     ' MIDI Data is being sent
  328.     LblInQueue.Caption = " Sending data..."
  329.     LblInQueue.Refresh
  330.     'Look through ListSysex to see if you have selected some sysex
  331.     'messages to send
  332.     For I = 0 To ListSysex.ListCount - 1
  333.         'When we first received the sysex message we reformated
  334.         'it to make it easier to edit.  Now since we're going to send it,
  335.         'we've got to get it back in its original format
  336.         If ListSysex.Selected(I) = True Then
  337.             SysexMessage = ""
  338.             ListSysex.ListIndex = I
  339.             '
  340.             ' Must tell MIDI CoolTools that this is a sysex message
  341.             MIDIOutput1.Message = &HF0
  342.             
  343.             'Start formating complete sysex message
  344.             SysexMessage = Chr$("&H" + Left(DisplayBufferString(I), 2))
  345.             
  346.             'Starting position of InStr search
  347.             n = 3
  348.             'We're going into this loop until we've reformated the complete
  349.             'sysex message
  350.             Do While Len(DisplayBufferString(I)) > n
  351.                 '
  352.                 'Since we've got a bunch of spaces " " that we've got
  353.                 'to find in our reformating, we're going to use the
  354.                 'InStr function to help us find them.  Look in the VB
  355.                 'Help file if you don't understand InStr!
  356.                 StringPosition = InStr(n, DisplayBufferString(I), " ")
  357.                 '
  358.                 'If 0 then we'll not put in the &H
  359.                 If Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)) = "0" Then
  360.                     SysexMessage = SysexMessage & Chr$(Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)))
  361.                 Else
  362.                     'If not 0 but just null, then we do nothing
  363.                     If Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)) = "" Then
  364.                         'null
  365.                     Else
  366.                         SysexMessage = SysexMessage & Chr$("&H" & Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)))
  367.                     End If
  368.                 End If
  369.                 n = StringPosition + 2
  370.             Loop
  371.             'Complete sysex message is all reformated and now ready
  372.             'to be queued
  373.             MIDIOutput1.Buffer = SysexMessage
  374.             MIDIOutput1.Action = MIDIOUT_QUEUE
  375.         End If
  376.     Next I
  377.     MIDIOutput1.Action = MIDIOUT_START
  378. End Sub
  379. Private Sub Form_Load()
  380.     Dim I As Integer
  381.     'UserMessage string is used when data is being received.
  382.     'It is used only to show that progress is happening
  383.     UserMessage = " Receiving data..."
  384.     ' Center the form on the screen
  385.     Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
  386. End Sub
  387. Private Sub Form_Unload(Cancel As Integer)
  388.     ' Stop the MIDI In
  389.     If (MIDIInput1.State <> 0) And (MIDIInput1.State <> 1) Then
  390.         MIDIInput1.Action = MIDIIN_STOP
  391.         End If
  392.     ' Close MIDI In
  393.     If (MIDIInput1.State <> 0) Then
  394.         MIDIInput1.Action = MIDIIN_CLOSE
  395.         End If
  396.     ' Close MIDI Out
  397.     MIDIOutput1.Action = MIDIOUT_CLOSE
  398.     End
  399. End Sub
  400. Private Sub ListSysex_Click()
  401.     'Display the sysex message that is stored in DisplayBufferString
  402.     TextSysex.Text = DisplayBufferString(ListSysex.ListIndex)
  403. End Sub
  404. Private Sub MIDIInput1_Error(ErrorCode As Integer, ErrorMessage As String)
  405.     '
  406.     ' Midi input error, display message
  407.     '
  408.    If (ErrorCode <> 0) And (ErrorCode <> 8) Then
  409.       MsgBox ErrorMessage
  410.       End If
  411. End Sub
  412. Private Sub MIDIInput1_Message()
  413.     Dim n As Integer
  414.     Dim SysexListCount As Integer
  415.     SysexListCount = ListSysex.ListCount
  416.     '
  417.     ' The MIDIInput1.SysexMaxSize property is set to 5000 bytes in this
  418.     ' example.  For larger system exclusive messages, increase this
  419.     ' property. If you are not going to receive system exclusive
  420.     ' message, set the SysexMaxSize property to 0.
  421.     '
  422.     '
  423.     'This do while loop allows you to take all the messages that are
  424.     'waiting in the message queue.
  425.     Do While MIDIInput1.MessageCount > 0 And Len(MIDIInput1.Buffer) > 0
  426.         'Show the users that data is coming in
  427.         UserMessage = UserMessage + "...."
  428.         LblInQueue.Caption = UserMessage
  429.         LblInQueue.Refresh
  430.         
  431.         '
  432.         'Add each Message to the List box so that the users can click
  433.         'through each message.  We'll set this up to allow the users
  434.         'to view and edit the complete sysex message
  435.         ListSysex.AddItem "Message " & Str(SysexListCount) & " Length=" & Str(Len(MIDIInput1.Buffer))
  436.         'A complete sysex message has been received into the
  437.         'MIDIInput.Buffer
  438.         '
  439.         'Now we'll put the first data byte of sysex message into
  440.         'the DisplayBufferString.
  441.         DisplayBufferString(SysexListCount) = Hex(Asc(Left(MIDIInput1.Buffer, 1)))
  442.         'Now we're going to go through the remaining portion of the
  443.         'sysex message and get it ready to display.  We'll then be able
  444.         'to view and edit the complete sysex message.
  445.         For n = 2 To Len(MIDIInput1.Buffer)
  446.             DisplayBufferString(SysexListCount) = DisplayBufferString(SysexListCount) & " " & Hex(Asc(Mid(MIDIInput1.Buffer, n, 1)))
  447.         Next n
  448.         '
  449.         'DisplayBufferString now contains the sysex message in a viewable
  450.         'format
  451.         '
  452.         'Remove the MIDI data from the MIDI IN queue
  453.         '
  454.         MIDIInput1.Action = MIDIIN_REMOVE
  455.     Loop
  456.     ' IF the buffer is > 0 then we've received some sysex data
  457.     If Len(DisplayBufferString(SysexListCount)) > 0 Then
  458.         LblInQueue.Caption = " Sysex Data Received!"
  459.     ElseIf mnuMidiThru.Checked = True Then
  460.         'If MIDI Thru is checked in the menu, send non-sysex data out
  461.         MIDIOutput1.Message = MIDIInput1.Message
  462.         MIDIOutput1.Data1 = MIDIInput1.Data1
  463.         MIDIOutput1.Data2 = MIDIInput1.Data2
  464.         MIDIInput1.Action = MIDIIN_REMOVE
  465.         MIDIOutput1.Action = MIDIOUT_START
  466.         MIDIOutput1.Action = MIDIOUT_SEND
  467.         MIDIOutput1.Action = MIDIOUT_STOP
  468.     End If
  469. End Sub
  470. Private Sub MIDIOutOpen()
  471. End Sub
  472. Private Sub MIDIOutput1_Error(ErrorCode As Integer, ErrorMessage As String)
  473.     '
  474.     ' Midi output error, display message
  475.     '
  476.    If (ErrorCode <> 0) And (ErrorCode <> 8) Then
  477.       MsgBox ErrorMessage
  478.       End If
  479. End Sub
  480. Private Sub MIDIOutput1_QueueEmpty()
  481.     '
  482.     'Once queue becomes empty, get ready to record again
  483.     '
  484.     MIDIOutput1.Action = MIDIOUT_STOP
  485.     ' MIDI Data is being received
  486.     LblInQueue.Caption = " Data Sent!"
  487. End Sub
  488. Private Sub mnuFileExit_Click()
  489.     ' Stop the MIDI In
  490.     MIDIInput1.Action = MIDIIN_STOP
  491.     ' Close MIDI In
  492.     MIDIInput1.Action = MIDIIN_CLOSE
  493.     ' Close MIDI Out
  494.     MIDIOutput1.Action = MIDIOUT_CLOSE
  495.     End
  496. End Sub
  497. Private Sub mnuFileLoadBank_Click()
  498.     Dim SysexBytes As String
  499.     Dim SysexListCount As Integer
  500.     Dim X As Integer
  501.     SysexListCount = ListSysex.ListCount
  502.     On Error Resume Next
  503.     CMDialog1.DialogTitle = "Load System Exclusive File"
  504.     CMDialog1.Flags = &H1000&
  505.     CMDialog1.Action = 1
  506.     If (Err) Then
  507.         Exit Sub
  508.     End If
  509.     Open CMDialog1.filename For Binary As #1
  510.     Do While EOF(1) <> True
  511.         SysexBytes = " "
  512.         Get #1, , SysexBytes
  513.         DisplayBufferString(SysexListCount) = LTrim(DisplayBufferString(SysexListCount)) & " " & Hex(Asc(SysexBytes))
  514.     Loop
  515.     Close #1
  516.     DisplayBufferString(SysexListCount) = Left(DisplayBufferString(SysexListCount), (Len(DisplayBufferString(SysexListCount)) - 2))
  517.     ListSysex.AddItem CMDialog1.filename & " Len =" & Str(Len(DisplayBufferString(SysexListCount)))
  518.     'unselect all
  519.     For X = 0 To ListSysex.ListCount - 1
  520.         ListSysex.Selected(X) = False
  521.     Next
  522.     'Highlight the loaded file
  523.     ListSysex.Selected(ListSysex.ListCount - 1) = True
  524. End Sub
  525. Private Sub mnuMidiSetup_Click()
  526.     MIDISetupForm.Show MODAL
  527. End Sub
  528. Private Sub mnuMidiThru_Click()
  529.     'Switch check mark on and off
  530.     If mnuMidiThru.Checked = True Then
  531.         mnuMidiThru.Checked = False
  532.     Else
  533.         mnuMidiThru.Checked = True
  534.     End If
  535. End Sub
  536. Private Sub MnuSaveBankAs_Click()
  537.     Dim I As Integer
  538.     Dim n As Integer
  539.     Dim SysexMessage As String
  540.     Dim StringPosition As Integer
  541.     ' MIDI Data is being sent
  542.     LblInQueue.Caption = " Saving data..."
  543.     LblInQueue.Refresh
  544.     On Error Resume Next
  545.     CMDialog1.DialogTitle = "Save Selected Sysex Message"
  546.     CMDialog1.Flags = &H1000&
  547.     CMDialog1.Action = 2
  548.     If (Err) Then
  549.         Exit Sub
  550.     End If
  551.     Open CMDialog1.filename For Binary As #1
  552.     SysexMessage = ""
  553.     'Look through ListSysex to see if you have selected some sysex
  554.     'messages to send
  555.     For I = 0 To ListSysex.ListCount - 1
  556.         'When we first received the sysex message we reformated
  557.         'it to make it easier to edit.  Now since we're going to send it,
  558.         'we've got to get it back in its original format
  559.         If ListSysex.Selected(I) = True Then
  560.             
  561.             ListSysex.ListIndex = I
  562.             '
  563.             
  564.             'Start formating complete sysex message
  565.             SysexMessage = Chr$("&H" + Left(DisplayBufferString(I), 2))
  566.             'Write begining F0 sysex byte to file
  567.             Put #1, , SysexMessage
  568.             
  569.             'Starting position of InStr search
  570.             n = 3
  571.             'We're going into this loop until we've reformated the complete
  572.             'sysex message
  573.             Do While Len(DisplayBufferString(I)) > n
  574.                 '
  575.                 'Since we've got a bunch of spaces " " that we've got
  576.                 'to find in our reformating, we're going to use the
  577.                 'InStr function to help us find them.  Look in the VB
  578.                 'Help file if you don't understand InStr!
  579.                 StringPosition = InStr(n, DisplayBufferString(I), " ")
  580.                 '
  581.                 'If 0 then we'll not put in the &H
  582.                 If Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)) = "0" Then
  583.                     SysexMessage = Chr$(Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)))
  584.                 Else
  585.                     'If not 0 but just null, then we do nothing
  586.                     If Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)) = "" Then
  587.                         'null
  588.                     Else
  589.                         SysexMessage = Chr$("&H" & Trim(Mid(DisplayBufferString(I), StringPosition + 1, 2)))
  590.                     End If
  591.                 End If
  592.                 'Write sysex data to file
  593.                 Put #1, , SysexMessage
  594.                 n = StringPosition + 2
  595.             Loop
  596.         End If
  597.     Next I
  598.     Close #1
  599. End Sub
  600. Private Sub TextSysex_Change()
  601.     'You can edit the sysex message.  If you do make changes
  602.     'we'll update DisplayBufferString with those changes
  603.     DisplayBufferString(ListSysex.ListIndex) = TextSysex.Text
  604. End Sub
  605.